home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / program / ny_src.zip / NY2008.H < prev    next >
C/C++ Source or Header  |  1997-04-22  |  15KB  |  526 lines

  1. //                        0 - Critical Door error (no fossil, etc.)
  2. //                        1 - Carrier lost, user off-line
  3. //                        2 - Sysop terminated call, user off-line
  4. //                        3 - User time used up, user STILL ON-LINE
  5. //                        4 - Keyboard inactivity timeout, user off-line
  6. //                       10 - User chose to return to BBS
  7. //                       11 - User chose to logoff, user off-line
  8. //                       12 - Critical RAVote error
  9.  
  10. #ifndef TRUE
  11. #define FALSE 0
  12. #define TRUE !FALSE
  13. #endif
  14.  
  15.  
  16. #include <process.h>
  17. #include <math.h>
  18. #include <dos.h>
  19. #include <dirent.h>
  20.  
  21. #ifdef __TURBOC__
  22. #include <dir.h>
  23. #endif
  24.  
  25. #include <string.h>
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28. #include <time.h>
  29. #include <errno.h>
  30. #include <ctype.h>
  31. #include <share.h>
  32. #include <conio.h>
  33. #include <io.h>
  34. #include <fcntl.h>
  35. #include <sys\stat.h>
  36.  
  37. #ifdef __TURBOC__
  38. #include <locking.h>
  39. #endif
  40.  
  41. #ifdef __WATCOMC__
  42. #include <malloc.h>
  43. #endif
  44.  
  45.  
  46. #include <limits.h>
  47.  
  48. #ifndef __BEEN_HERE__
  49.  
  50. //I never did an OS2 port .. although i started on it
  51. #ifndef __OS2__
  52. #include "\odoors\opendoor.h"                   // Must be included in all doors
  53. #else
  54. #include "\os2port\opendoor.h"                   // Must be included in all doors
  55. #endif
  56.  
  57. #endif
  58. #define __BEEN_HERE__
  59.  
  60. #define USER_FILENAME           "NY2008.USR"
  61. #define SCR_FILENAME            "NY2008.SCR"
  62. #define KEY_FILENAME            "NYREG.KEY"
  63. #define CFG_FILENAME            "NY2008.CFG"
  64. #define MAIL_FILENAME           "NY2008.MSG"
  65. #define MAIL_INDEX              "NY2008.MSX"
  66. #define ENEMY_FILENAME          "NYENM.DAT"
  67. #define ENEMY_INDEX             "NYENM.IDX"
  68. #define MAX_USERS               30000
  69. #define FILE_ACCESS_MAX_WAIT    40
  70. #define LEVELS                  21
  71. #define PROG_NAME_CHARS    35
  72. #define PATH_CHARS         80
  73. #define FILENAME_CHARS     12
  74. #define MESSAGE_SUBJECT    "##NY2008 v0.10 IBBS Door Message"
  75. #define MESSAGE_PID        "\1PID: ODIBMS 1\r"
  76. #define MAX_LINE_LENGTH    70
  77. #define MESSAGE_HEADER     "$"
  78. #define MESSAGE_FOOTER     "$"
  79. #define DELIMITER_CHAR     '$'
  80. #define NODE_ADDRESS_CHARS 23
  81. #define SYSTEM_NAME_CHARS  40
  82. #define LOCATION_CHARS     40
  83.  
  84.  
  85. typedef enum {HANDS,
  86.           PEPPER,
  87.           KNIFE,
  88.           CHAIN,
  89.           GUN,
  90.           RIFLE,
  91.           LASER_GUN,
  92.           SHOTGUN,
  93.           MACHINEGUN,
  94.           GRANADE_LAUNCHER,
  95.           BLASTER,
  96.           A_BOMB,
  97.           SHARP_STICK,
  98.           SCREWDRIVER,
  99.           HAMMER,
  100.           LEAD_PIPE,
  101.           COLT,
  102.           ELEPHANT_GUN,
  103.           NAILGUN,
  104.           ASSAULT_RIFLE,
  105.           PROTON_GUN,
  106.           NEUTRON_PHASER,
  107.           ULTRASOUND_GUN} weapon;
  108. typedef enum {POT,HASH,LSD,COKE,PCP,HEROIN} drug_type;
  109. typedef enum {MALE,FEMALE} sex_type;
  110. typedef enum {HEADBANGER,HIPPIE,BIG_FAT_DUDE,CRACK_ADDICT,PUNK} guy_type;
  111. typedef enum {NONE,CRAPS,HERPES,SYPHILIS,AIDS} desease;
  112. typedef enum {ALIVE,UNCONCIOUS,DEAD} guy_status;
  113. typedef enum {NOWHERE,MOTEL,REG_HOTEL,EXP_HOTEL} hotel_type;
  114. typedef enum {CENTRAL_PARK,CENTRAL_PARK_IB,EVIL_STUFF,BANK,HEALING,FOOD,
  115.           DRUGS,ARMS,SEX,MAIL,REST,P_FIG,C_FIG,S_FIG,ENTRY_1,ENTRY_2,
  116.           ONLINE,NEWZ,LIST,CONSIOUS,ATTACK,WIN,MAINT_RUN,WEAPONS,COPS,
  117.           NEW,NATION,OTHER,NEW_NAME,NEW_WIN,NEW_LOOSE,TEN_BEST,BUSTED,
  118.           ASS_KICKED,ASS_KICKED_P,ASS_KICKED_O,COLORS_HELP,CH_DRUG,
  119.           LIST_IB_SYS,IBBS_MENU,HITMEN,TEN_BEST_IBBS,END} menu_t;
  120.  
  121. /*#define NO_MAIL_FLAG          0x0001
  122. #define NY2008_FALG2          0x0002
  123. #define NY2008_FALG3          0x0004
  124. #define NY2008_FALG4          0x0008
  125. #define NY2008_FALG5          0x0010
  126. #define NY2008_FALG6          0x0020*/
  127.  
  128.  
  129. int     main(int argc,char *argv[]);    // Function prototype declarations
  130. char    entry_menu(void);               // Menu draw...
  131. //char    central_park(void);
  132. //char    drugs(void);
  133. //char    money(void);
  134. //char    evil_stuff(void);
  135. //char    food(void);
  136. //char    guns(void);
  137. //char    get_laid(void);
  138. //char    healing(void);
  139. //char    mail(void);
  140.  
  141. char    callmenu(char allowed[],menu_t menu,int menu_line,char figst);
  142. void DisplayBestIB(void);
  143.  
  144. void    read_IGMs(void);
  145.  
  146. unsigned long   get_val(unsigned long def,unsigned long max);
  147. void    EnterStreet(void);
  148. void    ListPlayers(void);
  149. void    ListPlayersA(void);
  150. void    ListPlayersS(sex_type psex);
  151. void    DisplayStats(void);
  152. void    Maintanance(void);
  153. void    drug_ops(void);
  154. void    money_ops(void);
  155. void    get_laid_ops(void);
  156. void    food_ops(void);
  157. void    guns_ops(void);
  158. void    healing_ops(void);
  159. void    newz_ops(void);
  160. void    mail_ops(void);
  161. void    wrt_sts(void);
  162. void    exit_ops(void);
  163. void    SortScrFile(int usr, int max);
  164. void    ChangeOnlineRanks(void);
  165. void    WhosOnline(void);
  166. int     askifuser(char handle[25]);
  167. char    ny_get_answer(char *string);
  168. void    fig_ker(void);
  169. void    trim(char *numstr);
  170.  
  171. void    dobadwords(char *s);
  172.  
  173. void    print_drug(drug_type drug);
  174. //void  print_drug(drug_type drug,int len);
  175.  
  176. void    print_arm(weapon arm);
  177.  
  178. void    points_raise(unsigned long raise);
  179. int     CheckForHandle(char handle[25]);
  180. void    Die(int diecode); //die of reason 1=drugs 2=hunger 3=std
  181. void    ny_kernel(void);
  182. //char    rest(void);
  183. void    rest_ops(void);
  184. void    get_line(char beg[],char line[],char ovr[],int wrap);
  185. void    read_mail(void);
  186. void    illness(void);
  187. void    illness(desease ill, int inf, int rape=FALSE);
  188. void    news_post(char line[], char name1[], char name2[], int flag);
  189. void    print_disease(desease ill);
  190. int     seereg(char bbsname[]);
  191. void    get_bbsname(char bbsname[]);
  192. //void  cap_names(char name[]);
  193. void    change_info(void);
  194. void    dump(void);
  195. int     strzcmp(char str1[], char str2[]);
  196. void    del(char *file);
  197. //void    checknodes(void);
  198.  
  199. void WaitForEnter(void);
  200. int ReadOrAddCurrentUser(void);
  201. void WriteCurrentUser(void);
  202. long randomf(long max);
  203. //FILE *ExculsiveFileOpen(char *pszFileName, char *pszMode);
  204. FILE *ShareFileOpen(char *pszFileName, char *pszMode);
  205. size_t ny_fread(const void *ptr, size_t size, size_t n, FILE*stream);
  206. size_t ny_fwrite(const void *ptr, size_t size, size_t n, FILE*stream);
  207. void CustomConfigFunction(char *pszKeyword, char *pszOptions);
  208. void strzcpy(char dest[],const char src[], int beg,int end);
  209. double DrgPtsCoef(void);
  210. void DisplayBest(void);
  211. void AddBestPlayer(void);
  212. void MakeFiles(void);
  213. char *D_Num(int num);
  214. char *D_Num(long num);
  215. char *D_Num(unsigned long num);
  216. void heal_wounds(void);
  217. void take_drug(void);
  218. void money_plus(unsigned long howmuch);
  219. void money_minus(unsigned long howmuch);
  220. void disp_fig_stats(void);
  221. void SortScrFileB(int usr);
  222. void points_loose(unsigned long lost);
  223. void CrashRecovery(void);
  224. void IGM(char exenam[]);
  225. void IGM_ops(void);
  226. void CreateDropFile(int all);
  227. void ny_disp_emu(char line[]);
  228. void nyr_disp_emu(char line[]);
  229. void ny_clr_scr();
  230. //void print_gun_prices(void);
  231. void ny_disp_emu(char line[],int min);
  232. void ny_disp_emu_file(FILE *ans_phile,FILE *asc_phile,char line[],int min);
  233. char *ny_un_emu(char line[]);
  234. char *ny_un_emu(char line[],char out[]);
  235. void scr_save(void);
  236. void scr_res(void);
  237. void ch_game_d(void);
  238. void ch_flag_d(void);
  239. //void strim(char s[]);
  240. void forrest_IGM(void);
  241. void call_IGM(char exenamr[]);
  242. void read_fight_IGMs(void);
  243. FILE *ShareFileOpenAR(char *pszFileName, char *pszMode);
  244. void UserStatus(void);
  245. void ny_pers(unsigned char message);
  246. void time_slice(void);
  247. int copyfile(char *file1,char *file2);
  248. int ny_remove(char *pszFileName);
  249. void game_events(void);
  250. void ny_stat_line(int line,int before,int after);
  251. void ny_read_stat_line(int line,char *string, FILE *phile);
  252. void read_ibmail(void);
  253. char *LocationOf(char *address);
  254. int ibbs_bbs_list(void);
  255. void ibbs_bbs_name(int bbs,int sex,int nochoice,char nameI[],int *dbn,int *pn);
  256. //char ibbs_m(void);
  257. void ibbs_ops(void);
  258. void AddBestPlayerIB(void);
  259. void AddBestPlayerInIB(char *name, unsigned long points);
  260. /*int findf(char *pathname, struct ffblk *ffblk, int attrib);
  261. int fnext(struct ffblk *ffblk);
  262. int strwcmp(char *format,char *string);*/
  263.  
  264.  
  265.  
  266.  
  267.  
  268. /*typedef struct {
  269.     int             first_enemy[LEVELS],
  270.             last_enemy[LEVELS];
  271.     } enemy_idx;*/
  272.  
  273.  
  274. typedef struct {
  275.     char    sender[25];
  276.     char    senderI[36];
  277.     sex_type sender_sex;
  278.     char    n1;
  279.     char    recver[25];
  280.     char    recverI[36];
  281.     long    location;
  282.     int     afterquote;
  283.     int     length;
  284.     int     flirt;
  285.     desease ill;
  286.     char    n2;
  287.     int     inf;
  288.     int     deleted;
  289.     } mail_idx_type;
  290.  
  291.  
  292. /*typedef struct {
  293.     char    sender[25];
  294.     char    senderI[36];
  295.     sex_type sender_sex;
  296.     char    node_s[NODE_ADDRESS_CHARS + 1];
  297.     char    node_r[NODE_ADDRESS_CHARS + 1];
  298.     char    recver[25];
  299.     char    recverI[36];
  300.     int     quote_length;
  301.     int     length;
  302.     int     flirt;
  303.     desease ill;
  304.     int     inf;
  305.     int     deleted;
  306.     } ibbs_mail_idx_type;*/
  307.  
  308. //defined in interbbs.h changed enum to char (as ibbs_mail_type_1)
  309. typedef struct {
  310.     char    sender[25];
  311.     char    senderI[36];
  312.     sex_type sender_sex;
  313.     char    node_s[NODE_ADDRESS_CHARS + 1];
  314.     char    node_r[NODE_ADDRESS_CHARS + 1];
  315.     char    recver[25];
  316.     char    recverI[36];
  317.     char    quote_length;
  318.     char    length;
  319.     int     flirt;
  320.     desease ill;
  321.     int     inf;
  322.     char    deleted;
  323.     char    lines[20][81];
  324. //    char    quote_lines[10][81];
  325.     } ibbs_mail_type;
  326.  
  327.  
  328. typedef struct {
  329.     char            name[25];
  330.     guy_type        nation;
  331.     char            n1;
  332.     int             level;
  333.     unsigned long   points;
  334.     guy_status      alive;
  335.     char            n2;
  336.     sex_type        sex;
  337.     char            n3;
  338.     int             user_num,
  339.             online;
  340.     } scr_rec;
  341.  
  342. typedef struct {
  343.     char            name[25];
  344.     char            nameI[36];
  345.     guy_type        nation;
  346.     int             level;
  347.     unsigned long   points;
  348.     sex_type        sex;
  349.     } ibbs_scr_rec;
  350.  
  351. typedef struct {
  352.     char            name[25];
  353.     char            nameI[36];
  354.     guy_type        nation;
  355.     int             level;
  356.     unsigned long   points;
  357.     sex_type        sex;
  358.     char        node[NODE_ADDRESS_CHARS + 1];
  359.     } ibbs_scr_spy_rec;
  360.  
  361.  
  362.  
  363.  
  364. typedef struct {
  365.     char        node[NODE_ADDRESS_CHARS + 1];
  366.     unsigned long   hi_points;
  367.     } ibbs_bbs_rec;
  368.  
  369. typedef struct {
  370.     char        node[NODE_ADDRESS_CHARS + 1];
  371.     unsigned long   hi_points;
  372.     int        players;
  373.     int        player_list; //number of file with player list
  374.     } ibbs_bbs_spy_rec;
  375.  
  376.  
  377. typedef struct {
  378.     int        action;
  379.     char            name_s[25];
  380.     char            name_sI[36];
  381.     char            name_r[25];
  382.     char            name_rI[36];
  383.     char        node_s[NODE_ADDRESS_CHARS + 1];
  384.        //    unsigned long   money;
  385.     char        data[10];
  386.     } ibbs_act_rec;
  387.  
  388.     /*actions:
  389.       0=name change name_sI change to name_s
  390.       1=spy on name_rI
  391.     */
  392.  
  393.  
  394. typedef struct {
  395.     char            name[25];
  396.     unsigned long   points;
  397.     } best_rec_type;
  398.  
  399. typedef struct {
  400.     char            name[25];
  401.     unsigned long   points;
  402.     char         location[NODE_ADDRESS_CHARS + 1];
  403.     } ibbs_best_rec_type;
  404.  
  405.  
  406. typedef struct {
  407.     char            name[36];
  408.     long            hitpoints,
  409.             strength,
  410.             defense;
  411.     weapon          arm;
  412.     char            n1;
  413.     } enemy;
  414.  
  415. //Player User File structure (beta6+)
  416. typedef struct {
  417.     //character fields
  418.     char            bbsname[36],     //the BBS name of the user
  419.             name[25],        //the name of the character
  420.             say_win[41],     //what the user says when he wins
  421.             say_loose[41];   // "    "    "   "    "   "  looses
  422.     //integer records
  423.     int             rank,            //user rank
  424.             days_not_on,     //days the user gas been inactive
  425.             strength,        //attacking strenght of the user
  426.             defense,         //defensive strenght
  427.             condoms,         //condoms user has
  428.             since_got_laid,  //days since the user last got laid
  429.             drug_hits,       //the hist that the user has
  430.             drug_days_since; //if addicted how long the user
  431.                      //has not used the drug
  432.  
  433.     //long type records
  434.     long            hitpoints,       //users hitpoints
  435.             maxhitpoints;    //maximum of the users hitpoints
  436.  
  437.     //unsigned long type record
  438.     unsigned long   points,          //users points
  439.             money,           //money in hand
  440.             bank;            //money in bank
  441.  
  442.     //unsigned char type records used as values
  443.     unsigned char   level,           //user level
  444.             turns,           //fight the user has left today
  445.             hunger,          // % of hunger
  446.             sex_today,       //sex turns left today
  447.             std_percent,     // % of current std
  448.             drug_addiction,  // % of drug addiction
  449.             drug_high,       // % of how "high" the player is
  450.             hotel_paid_fer,  //for how many more days the hotel
  451.                      //is paid for
  452.             days_in_hospital;//how many days has the use been
  453.                      //in hospital
  454.  
  455.     /*enumerated types stored as char!!! (not int)*/
  456.     guy_status      alive;           //user: alive, unconsious, or dead
  457.     sex_type        sex;             //user sex: Male, Female
  458.     guy_type        nation;          //what is he:
  459.                      //punk, headbanger ...
  460.     weapon          arm;             //players weapon
  461.     desease         std;             //current player std
  462.     drug_type       drug;            //current player drug type
  463.     hotel_type      rest_where;      //where the user is staying lately
  464.  
  465.     /*added values BETA 9*/
  466.     char            wtc;             //# of wtc bombings allowed per day
  467.                      //default=1
  468.     char            poison;          //number of poisoning of watr allowed
  469.                      //per day, default=1
  470.     /*added values v0.10*/
  471.     unsigned char   rocks,           //Rocks, usable in fights
  472.             throwing_ability,//Throwing ability 0-100
  473.             punch_ability,   //Punching ability 0-100
  474.             kick_ability;    //Kicking ability 0-100
  475.     char            InterBBSMoves;
  476.  
  477. /*reserved for future use 3 bytes reset to 0*/
  478.     char            res1;
  479.     int        res2;
  480.       } user_rec;
  481.  
  482. #include "ibbsny.h"
  483.  
  484.  
  485. /*
  486. typedef struct {
  487.     char            bbsname[36],
  488.             name[25];
  489.     guy_type        nation;
  490.     int             level,
  491.             rank;
  492.     unsigned long   points,
  493.             money,
  494.             bank;
  495.     guy_status      alive;
  496.     int             days_not_on;
  497.     sex_type        sex;
  498.     char            say_win[41],
  499.             say_loose[41];
  500.     int             turns,
  501.             hunger,
  502.             strength,
  503.             defense;
  504.     long            hitpoints,
  505.             maxhitpoints;
  506.     weapon          arm;
  507.     int             condoms;
  508.     int             since_got_laid;
  509.     int             sex_today;
  510.     desease         std;
  511.     int             std_percent;
  512.     drug_type       drug;
  513.     int             drug_hits,
  514.             drug_addiction,
  515.             drug_high,
  516.             drug_days_since;
  517.     hotel_type      rest_where;
  518.     unsigned char   hotel_paid_fer,
  519.             days_in_hospital;
  520.     int             res1,
  521.             res2,
  522.             res3,
  523.             res4,
  524.             res5;
  525.     } user_rec;*/
  526.